import request from '@/utils/request'

/*
 * 任务请求
 */
const taskType = {
  1: {
    url:'task',
    name: '普通任务'
  },
  2: {
    url:'task_archives',
    name: '档案任务'
  },
  3: {
    url:'task_document',
    name: '公文任务'
  }
}

// 列表
export function taskIndex(option) {
  return request({
    url: `${taskType[option.type].url}/index`,
    method: 'GET',
    params:option.data
  })
}
//详情
export function taskEdit(option) {
  return request({
    url: `${taskType[option.type].url}/edit`,
    method: 'GET',
    params:option.data
  })
}
//日志列表
export function taskNoteList(option) {
  return request({
    url: `${taskType[option.type].url}/reportList`,
    method: 'GET',
    params:option.data
  })
}
// 接受任务
export function taskAccept(option) {
  return request({
    url: `${taskType[option.type].url}/accept`,
    method: 'GET',
    params:option.data
  })
}

// 转派任务
export function taskReply(option) {
  return request({
    url: `${taskType[option.type].url}/reply`,
    method: 'POST',
    data: option.data
  })
}

// 完成任务，结束任务
export function taskReport(option) {
  return request({
    url: `${taskType[option.type].url}/report`,
    method: 'POST',
    data: option.data
  })
}
// 填写日志
export function taskBuildNote(option) {
  return request({
    url: `${taskType[option.type].url}/reportNotEnd`,
    method: 'POST',
    data: option.data
  })
}
// 发布者审阅人抄送人评价
export function taskEvaluate(option) {
  return request({
    url: `${taskType[option.type].url}/evaluate`,
    method: 'POST',
    data: option.data
  })
}

export function taskExamine(option) {
  return request({
    url: `${taskType[option.type].url}/examine`,
    method: 'POST',
    data: option.data
  })
}
// 列表
export function taskDetel(option) {
  return request({
    url: `${taskType[option.type].url}/delete`,
    method: 'GET',
    params:option.data
  })
}
